<?php
/**
 * Research Center Block
 *
 * @author Xavier VILAIN
 * @package Nawa\MedicalStudy\MedicalCenter
 * @license #license#
 * 
 */
use Fox\Grid\FieldCat\Field\Renderer\Anchor;
use Fox\Generator;
use Nawa\Messages;
use Fox\Html\Button;
use Fox\Grid;
use Fox\Html\Block;

$xview = Xview::instance();
$msid = $xview->val('msid');
$block = new Block("bMedicalCentersPartners",Msg(Messages::BUNDLE,Messages::LABEL_MEDICAL_CENTERS));
$block->collapsed(false);
$gridName = "gMedicalCentersPartners";
$grid = new Grid($gridName);
$grid->fieldcat(array(array('mc_reference','reference_extern'),'name1','name2','msid','mcid'));
$grid->fieldcat()->setFieldAttr('*', 'SetHiddenInput',true);
$grid->fieldcat()->field('mcid')->hidden();
$grid->fieldcat()->field('msid')->hidden();
$grid->fieldcat()->field('reference_extern')->input();
$grid->fieldcat()->setFieldAttr(array('reference_extern','name1','name2'), 'renderers',new Anchor(
Generator::url('medicalstudies','medicalcenter',null,array('msid' => Generator::useElement('msid') ,
						'mcid' => Generator::useElement('mcid') ))
));
$grid->setCoche();
$grid->footer()->add(new Button('adnew',Generator::display('addPartners',
Generator::url('medicalstudies','medicalcenters','add',array('msid' => $msid)),
											"MC_$gridName")));
$grid->footer()->add(new Button(Grid::BUTTON_DELETE_LINE,
	Generator::gridDeleteLines($gridName),
	Msg(Fox\Msg::BUNDLE,Fox\Msg::BUT_DELETE)));
$block->add($grid);
return $block;